|
|
|
|
|
|
|
Figure 16.5.
The Departments table added to NORMDAT4.MDB. |
|
|
|
|
|
|
|
|
Do Not Store Calculated Data in Your Tables |
|
|
|
|
|
|
|
|
It is important to note here that one of the results of the third rule of data normalization is that you should not store calculated fields in a data table. Calculated fields are fields that contain derived data such as year-to-date totals, a line in the invoice table that contains the totals of several other rows in the invoice table, and so forth. Calculated fields do not describe the primary key. Calculated fields are derived data. It is a bad practice to store derived data in live data tables. |
|
|
|
|
|
|
|
|
Derived data can easily fall out of sync with the individual rows that make up the total data. What happens if the individual rows that add up to the total are altered or deleted? How do you make sure the row that holds the total is updated each time any line item row is changed? Storing derived data might seem to be faster, but it is not easier. And dealing with derived data opens your database to possible update and delete integrity problems each time a user touches either the prime data rows or the total data rows. Calculated data should not be stored. It should always be computed using the prime data at the time it is needed. |
|
|
|
|
| |
|
|
|
|
Before continuing with this lesson, load the NORMDAT4.MDB database into Visdata. |
|
|
|
|
|
|
|